USE [nandolc_XtremBikingTest]
GO

/****** Object:  Table [nandolc_XB].[Perfil]    Script Date: 11/11/2014 17:16:02 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [nandolc_XB].[Perfil](
	[IdPerfil] [int] IDENTITY(1,1) NOT NULL,
	[Nombre] [varchar](50) NOT NULL,
	[Descripcion] [varchar](max) NULL,
	[Activo] [bit] NOT NULL,
 CONSTRAINT [PK_Perfil] PRIMARY KEY CLUSTERED 
(
	[IdPerfil] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

USE [nandolc_XtremBikingTest]
GO

/****** Object:  Table [nandolc_XB].[Usuario]    Script Date: 11/11/2014 17:19:48 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [nandolc_XB].[Usuario](
	[IdUsuario] [bigint] IDENTITY(1,1) NOT NULL,
	[Nombre] [varchar](50) NOT NULL,
	[Apellidos] [varchar](50) NOT NULL,
	[Mail] [varchar](50) NOT NULL,
	[Clave] [varchar](100) NOT NULL,
	[IdPerfil] [int] NOT NULL,
	[IdEstado] [int] NOT NULL,
	[FechaUltLogin] [datetime2](7) NOT NULL,
	[FechaRegistro] [datetime2](7) NOT NULL,
	[PrimerLogin] [bit] NOT NULL,
	[IdNivelUsuario] [int] NOT NULL,
 CONSTRAINT [PK_Usuario] PRIMARY KEY CLUSTERED 
(
	[IdUsuario] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [nandolc_XB].[Usuario]  WITH CHECK ADD  CONSTRAINT [FK_Usuario_Perfil] FOREIGN KEY([IdPerfil])
REFERENCES [nandolc_XB].[Perfil] ([IdPerfil])
GO

ALTER TABLE [nandolc_XB].[Usuario] CHECK CONSTRAINT [FK_Usuario_Perfil]
GO


USE [nandolc_XtremBikingTest]
GO

/****** Object:  Table [nandolc_XB].[FichaUsuario]    Script Date: 11/11/2014 17:22:01 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [nandolc_XB].[FichaUsuario](
	[IdUsuario] [bigint] NOT NULL,
	[Direccion] [varchar](250) NOT NULL,
	[Telefono] [varchar](20) NOT NULL,
	[Celular] [varchar](20) NOT NULL,
	[Documento] [varchar](10) NOT NULL,
	[FechaNacimiento] [date] NOT NULL,
	[Altura] [int] NULL,
	[Peso] [int] NULL,
	[Antiguedad] [varchar](50) NULL,
	[CompetenciasConcurridas] [varchar](max) NULL,
	[KmRecorridos] [int] NULL,
	[PorQueCiclismo] [varchar](max) NULL,
	[PulsoMaximo] [int] NULL,
	[PulsoBasal] [int] NULL,
	[TiempoDisponibleEntrenamiento] [varchar](max) NULL,
	[TrabajoEstudioOtros] [varchar](max) NULL,
	[MetasCortoPlazo] [varchar](max) NULL,
	[MetasLargoPlazo] [varchar](max) NULL,
 CONSTRAINT [PK_FichaUsuario] PRIMARY KEY CLUSTERED 
(
	[IdUsuario] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [nandolc_XB].[FichaUsuario]  WITH CHECK ADD  CONSTRAINT [FK_FichaUsuario_Usuario] FOREIGN KEY([IdUsuario])
REFERENCES [nandolc_XB].[Usuario] ([IdUsuario])
GO

ALTER TABLE [nandolc_XB].[FichaUsuario] CHECK CONSTRAINT [FK_FichaUsuario_Usuario]
GO


USE [nandolc_XtremBikingTest]
GO

/****** Object:  Table [nandolc_XB].[Bioposicion]    Script Date: 11/11/2014 17:23:22 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [nandolc_XB].[Bioposicion](
	[IdBioposicion] [bigint] NOT NULL,
	[IdUsuario] [bigint] NOT NULL,
	[Antiguedad] [varchar](50) NOT NULL,
	[Altura] [int] NOT NULL,
	[Peso] [decimal](18, 0) NOT NULL,
	[LargoPiernas] [decimal](18, 0) NOT NULL,
 CONSTRAINT [PK_Bioposicion] PRIMARY KEY CLUSTERED 
(
	[IdBioposicion] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [nandolc_XB].[Bioposicion]  WITH CHECK ADD  CONSTRAINT [FK_Bioposicion_Usuario] FOREIGN KEY([IdUsuario])
REFERENCES [nandolc_XB].[Usuario] ([IdUsuario])
GO

ALTER TABLE [nandolc_XB].[Bioposicion] CHECK CONSTRAINT [FK_Bioposicion_Usuario]
GO


USE [nandolc_XtremBikingTest]
GO

/****** Object:  Table [nandolc_XB].[Bicicleta]    Script Date: 11/11/2014 17:24:21 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [nandolc_XB].[Bicicleta](
	[IdBicicleta] [bigint] NOT NULL,
	[IdBioposicion] [bigint] NOT NULL,
	[IdTipoBicicleta] [int] NOT NULL,
	[AltoAsiento] [decimal](18, 0) NOT NULL,
	[LargoAvance] [decimal](18, 0) NOT NULL,
 CONSTRAINT [PK_Bicicleta] PRIMARY KEY CLUSTERED 
(
	[IdBicicleta] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [nandolc_XB].[Bicicleta]  WITH CHECK ADD  CONSTRAINT [FK_Bicicleta_Bioposicion] FOREIGN KEY([IdBioposicion])
REFERENCES [nandolc_XB].[Bioposicion] ([IdBioposicion])
GO

ALTER TABLE [nandolc_XB].[Bicicleta] CHECK CONSTRAINT [FK_Bicicleta_Bioposicion]
GO


USE [nandolc_XtremBikingTest]
GO

/****** Object:  Table [nandolc_XB].[TiposRutina]    Script Date: 11/11/2014 17:27:13 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [nandolc_XB].[TiposRutina](
	[IdTipoRutina] [int] NOT NULL,
	[Nombre] [varchar](50) NOT NULL,
 CONSTRAINT [PK_TiposRutina] PRIMARY KEY CLUSTERED 
(
	[IdTipoRutina] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO


USE [nandolc_XtremBikingTest]
GO

/****** Object:  Table [nandolc_XB].[Rutina]    Script Date: 11/11/2014 17:28:26 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [nandolc_XB].[Rutina](
	[IdRutina] [bigint] NOT NULL,
	[DuracionTotal] [time](0) NOT NULL,
	[IdTipoRutina] [int] NOT NULL,
	[IdNivelUsuario] [int] NOT NULL,
	[Activa] [bit] NOT NULL,
 CONSTRAINT [PK_Rutina] PRIMARY KEY CLUSTERED 
(
	[IdRutina] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

ALTER TABLE [nandolc_XB].[Rutina]  WITH CHECK ADD  CONSTRAINT [FK_Rutina_TiposRutina] FOREIGN KEY([IdTipoRutina])
REFERENCES [nandolc_XB].[TiposRutina] ([IdTipoRutina])
GO

ALTER TABLE [nandolc_XB].[Rutina] CHECK CONSTRAINT [FK_Rutina_TiposRutina]
GO

USE [nandolc_XtremBikingTest]
GO

/****** Object:  Table [nandolc_XB].[SeriesRutina]    Script Date: 11/11/2014 17:29:36 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [nandolc_XB].[SeriesRutina](
	[IdSerie] [bigint] NOT NULL,
	[IdRutina] [bigint] NOT NULL,
	[Trabajo] [varchar](200) NOT NULL,
 CONSTRAINT [PK_SeriesRutina] PRIMARY KEY CLUSTERED 
(
	[IdSerie] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO

ALTER TABLE [nandolc_XB].[SeriesRutina]  WITH CHECK ADD  CONSTRAINT [FK_SeriesRutina_Rutina] FOREIGN KEY([IdRutina])
REFERENCES [nandolc_XB].[Rutina] ([IdRutina])
GO

ALTER TABLE [nandolc_XB].[SeriesRutina] CHECK CONSTRAINT [FK_SeriesRutina_Rutina]
GO

USE [nandolc_XtremBikingTest]
GO

/****** Object:  Table [nandolc_XB].[Solicitud]    Script Date: 11/11/2014 17:30:47 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

SET ANSI_PADDING ON
GO

CREATE TABLE [nandolc_XB].[Solicitud](
	[IdSolicitud] [bigint] IDENTITY(1,1) NOT NULL,
	[Fecha] [datetime] NOT NULL,
	[Nombre] [varchar](100) NOT NULL,
	[Mail] [varchar](50) NOT NULL,
	[Telefono] [varchar](50) NOT NULL,
	[Celular] [varchar](50) NOT NULL,
	[Comentarios] [varchar](max) NOT NULL,
	[IdTipoSolicitud] [int] NOT NULL,
	[IdEstadoSolicitud] [int] NOT NULL,
 CONSTRAINT [PK_Solicitud] PRIMARY KEY CLUSTERED 
(
	[IdSolicitud] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO


